home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 2
/
United Public Domain Gold 2.iso
/
music_utilities
/
pt144.dms
/
pt144.adf
/
MIDI_Playground-1.03
/
SourceCode
/
amigados.c
next >
Wrap
C/C++ Source or Header
|
1993-01-23
|
2KB
|
66 lines
/**************************************************************************
* amigados.c: Requestor and Environment Variable routines.
* Part of MP, the MIDI Playground.
*
* Author: Daniel Barrett
* Version: See the file "version.h".
* Copyright: None! This program is in the Public Domain.
* Please share it with others.
***************************************************************************/
#include <exec/types.h>
#include <stdlib.h>
#include <functions.h>
#include <libraries/dos.h>
#include <libraries/dosextens.h>
void DisableRequestors(void);
void EnableRequestors(void);
#define ENV_NAME_LENGTH BUFSIZ
/* Return the value of ENV: environment variable "variableName", if it
* exists. We use this instead of the built-in getenv() because we
* want to turn off requestors during the search for ENV:, in case it
* is not mounted. */
char *GetEnv(char *variableName)
{
char *result;
DisableRequestors(); /* In case ENV: is non-existent. */
result = getenv(variableName);
EnableRequestors();
return(result);
}
/***************************************************************************
* Deal with requestors.
***************************************************************************/
static APTR oldWindowPtr;
static struct Process *theProc;
/* Turn off system requestors for this process. */
void DisableRequestors(void)
{
theProc = (struct Process *)FindTask(NULL);
oldWindowPtr = theProc->pr_WindowPtr;
theProc->pr_WindowPtr = (APTR)(-1L);
}
/* Turn on system requestors for this process, after they have been
* turned off by DisableRequestors(), above. */
void EnableRequestors(void)
{
theProc->pr_WindowPtr = oldWindowPtr;
}